<template>
  <div
    class="f f-ac mt-30 mb-30"
    :class="{
      'f-js': align == 'left',
      'f-jc': align == 'center',
      'f-je': align == 'right',
    }"
  >
    <el-pagination
      :background="background"
      :small="small"
      :disabled="disabled"
      :page-size="size"
      :current-page="page"
      :total="total"
      :page-sizes="sizes"
      layout="prev, pager, next"
      @size-change="sizeChange"
      @current-change="currentChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    // 显示背景色
    background: {
      type: Boolean,
      default: true,
    },
    // 条数
    size: {
      type: [Number, String],
      default: 10,
    },
    // 页数
    page: {
      type: [Number, String],
      default: 1,
    },
    // 总数
    total: {
      type: [Number, String],
      default: 0,
    },
    // 条数设置
    sizes: {
      type: Array,
      default: () => {
        return [10, 20, 30, 40, 50, 100];
      },
    },
    // 小型分页
    small: {
      type: Boolean,
      default: false,
    },
    // 禁用
    disabled: {
      type: Boolean,
      default: false,
    },
    // 显示位置 left center right
    align: {
      type: String,
      default: "right",
    },
  },
  methods: {
    // 切换条数
    sizeChange(size) {
      this.$emit("change-size", size);
    },
    // 切换页数
    currentChange(page) {
      this.$emit("change-page", page);
    },
  },
};
</script>

<style lang="scss" scoped></style>
